﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SingletonPattern
{
    /// <summary>
    /// 饿汉模式,静态初始化，没有达到lazy loading的效果
    /// </summary>
    /// <remarks>
    /// 在类装载的时候就初始化Singleton，有时候不是调用getInstance方法，调用别的静态方法，也会让类进行静态加载，没有达到lazy loading的效果
    /// </remarks>
    public class HungerSingleton
    {
        private static HungerSingleton _instance = new HungerSingleton();

        private HungerSingleton() { }

        /// <summary>
        /// Gets the instance.
        /// </summary>
        public static HungerSingleton Instance
        {
            get
            {
                return _instance;
            }
            
        }
    }
}
